<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8"/>
  <link rel="icon" href="/favicon.ico"/>
  <meta name="referrer" content="no-referrer">
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
  <!--  <script src="/assets/Cesium/Cesium.js"></script>-->
  <!--  <link rel="stylesheet" href="/assets/Cesium/Widgets/widgets.css">-->
  <script type="text/javascript" src="/r3dUtil/lib/include-lib.js" libpath="/chenglicun/r3dUtil/lib/"
          include="rsa,jquery,bootstrap,bootstrap-checkbox,font-awesome,web-icons,layer,haoutil,nprogress,toastr,admui,turf,echarts-gl,redslib-wing"></script>
  <link href="/r3dUtil/map/css/style.css" rel="stylesheet"/>
  <script type="text/javascript" src="/rsa/jsencrypt.js"></script>
  <script type="text/javascript" src="/rsa/crypto-js.js"></script>
  <title><%= title %></title>
  <script>
    //全局钩子
    window.SITE_CONFIG = {
      //api
      apiURL: "<%=apiURL%>",
      // WebSocket地址
      socketURL: "<%=socketURL%>"
    };
  </script>
</head>
<body>
<div id="app"></div>
<script type="module" src="./src/main.ts"></script>
<script>
  //绑定图层管理
  function bindToLayerControl(options) {
    var viewer = window.viewer;
    if (options._layer == null) {
      var _visible = options.visible;
      delete options.visible;
      var layer = new reds3d.layer.BaseLayer(options, viewer);
      layer._visible = _visible;
      options._layer = layer;
    }
    var manageLayersWidget = reds3d.widget.getClass('/r3dUtil/map/widgets/manageLayers/widget.js');
    if (manageLayersWidget) {
      manageLayersWidget.addOverlay(options);
    } else {
      viewer.gisdata.config.operationallayers.push(options);
    }
    return options._layer;
  }

  //取消绑定图层管理
  function unbindLayerControl(name) {
    var viewer = window.viewer
    var manageLayersWidget = reds3d.widget.getClass('/r3dUtil/map/widgets/manageLayers/widget.js');
    if (manageLayersWidget) {
      manageLayersWidget.removeLayer(name);
    } else {
      var operationallayersCfg = viewer.gisdata.config.operationallayers;
      for (var i = 0; i < operationallayersCfg.length; i++) {
        var item = operationallayersCfg[i];
        if (item.name == name) {
          operationallayersCfg.splice(i, 1);
          break;
        }
      }
    }
  }
</script>
</body>
</html>
